package com.syx.client.service;

import java.util.HashMap;

/**
 * @author 邵一鑫
 * @date 2024/1/13 22:29
 * 管理客户端连接到服务器的线程的类
 */
public class ManageConnectServerThread {

    private static HashMap<String, ClientConnectServerThread> threadMap = new HashMap<>();

    /**
     * 添加线程
     * @param userId key
     * @param clientConnectServerThread 客户端连接到服务端的线程
     */
    public static void addClientConnectServerThread(String userId, ClientConnectServerThread clientConnectServerThread) {
        threadMap.put(userId, clientConnectServerThread);
    }

    /**
     * 通过 userId 获取线程
     * @param userId key
     */
    public static ClientConnectServerThread getClientConnectServerThread(String userId) {
        return threadMap.get(userId);
    }

}
